import { dialog } from '@gis/lib/components/antd-dialog';

export function openEventHandleDialog(contentPro, dialogPro) {
  return new Promise((resolve, reject) => {
    dialog({
      content: () => import('./event-handle.vue'),
      contentProps: {
        ...contentPro,
      },
      dialogProps: {
        ...dialogPro,
        onOk: () => resolve(true),
      },
    });
  });
}

export function openEventAddDialog(data) {
  return new Promise((resolve, reject) => {
    dialog({
      content: () => import('./event-add.vue'),
      contentProps: {
        videoDetails: data,
      },
      dialogProps: {
        title: '新增事件',
        width: 'medium',
        // afterClose: () => dialog.showAll(),
        onOk: () => resolve(true),
      },
    });
  });
}
// 事件详情
export function openEventDetailsDialog(event_id, btnShow = false) {
  return new Promise((resolve) => {
    dialog({
      content: () => import('./event-details.vue'),
      contentProps: { event_id: event_id, btnShow: btnShow, onRefresh: () => resolve(true) },
      dialogProps: {
        title: '事件详情',
        width: 'medium',
        height: 'fixed',
        bodyStyle: { padding: 0 },
        footer: null,
        afterClose: resolve(true),
      },
    });
  });
}

export function openEventListDialog(data, handleStateFilterShow = true) {
  dialog({
    content: () => import('./event-list.vue'),
    contentProps: {
      paramsData: data, //默认area_code,事件状态handle_state
      handleStateFilterShow: handleStateFilterShow,
    },
    dialogProps: {
      title: '事件管理',
      width: 'large',
      height: 'fixed',
      footer: null,
      bodyStyle: { padding: 0 },
    },
  });
}
